interface SeasonState {
  currentSeason: Season;
  seasonalCrops: SeasonalCrop[];
  seasonalEvents: SeasonalEvent[];
  seasonalDecorations: SeasonalDecoration[];
  weatherEvents: WeatherEvent[];
}

enum Season {
  SPRING = 'spring',
  SUMMER = 'summer',
  AUTUMN = 'autumn',
  WINTER = 'winter'
}

interface SeasonalCrop {
  id: string;
  name: string;
  season: Season;
  growthTime: number;
  value: number;
  available: boolean;
}

interface SeasonalEvent {
  id: string;
  name: string;
  season: Season;
  startDate: Date;
  endDate: Date;
  rewards: any[];
  isActive: boolean;
}

interface SeasonalDecoration {
  id: string;
  name: string;
  season: Season;
  price: number;
  bonus: number;
}

interface WeatherEvent {
  type: string;
  severity: number;
  duration: number;
  effects: any[];
}

export const season = {
  namespaced: true,
  
  state: (): SeasonState => ({
    currentSeason: Season.SPRING,
    seasonalCrops: [],
    seasonalEvents: [],
    seasonalDecorations: [],
    weatherEvents: []
  }),

  mutations: {
    changeSeason(state, newSeason: Season) {
      state.currentSeason = newSeason;
    },
    
    addSeasonalCrop(state, crop: SeasonalCrop) {
      state.seasonalCrops.push(crop);
    },
    
    updateSeasonalEvent(state, event: SeasonalEvent) {
      const index = state.seasonalEvents.findIndex(e => e.id === event.id);
      if (index > -1) {
        state.seasonalEvents[index] = event;
      } else {
        state.seasonalEvents.push(event);
      }
    },
    
    addSeasonalDecoration(state, decoration: SeasonalDecoration) {
      state.seasonalDecorations.push(decoration);
    },
    
    addWeatherEvent(state, event: WeatherEvent) {
      state.weatherEvents.push(event);
    }
  },

  actions: {
    async initializeSeason({ commit }) {
      // 初始化季节系统
    },
    
    async progressSeason({ commit, state }) {
      // 处理季节更替
    },
    
    async startSeasonalEvent({ commit }, eventId: string) {
      // 开始季节性活动
    },
    
    async applyWeatherEffects({ commit }, weatherEvent: WeatherEvent) {
      // 应用天气效果
    }
  },

  getters: {
    currentSeasonalCrops: (state) => {
      return state.seasonalCrops.filter(crop => 
        crop.season === state.currentSeason && crop.available
      );
    },
    
    activeEvents: (state) => {
      const now = new Date();
      return state.seasonalEvents.filter(event => 
        event.startDate <= now && event.endDate >= now
      );
    },
    
    availableDecorations: (state) => {
      return state.seasonalDecorations.filter(decoration => 
        decoration.season === state.currentSeason
      );
    }
  }
}; 